package com.example.kaoqinmanager.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.kaoqinmanager.R;
import com.example.kaoqinmanager.bean.BulletinBean;
import com.example.kaoqinmanager.bean.DaKaTable;

import java.util.List;

/**
 * @author ypk
 * 创建日期：2021/12/15  10:53
 * 描述：
 */
public class BulletinAdapter extends RecyclerView.Adapter<BulletinAdapter.BulletinViewHolder> {

    private Context context;
    List<BulletinBean> list;

    public BulletinAdapter(Context context, List<BulletinBean> list) {
        this.context = context;
        this.list = list;
    }


    @NonNull
    @Override
    public BulletinViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(context).inflate(R.layout.item_bulletin, parent, false);
        return new BulletinViewHolder(inflate);
    }

    @Override
    public void onBindViewHolder(@NonNull BulletinViewHolder holder, int position) {
        holder.tvTitle.setText(list.get(position).getTvTitle());
        holder.tvName.setText(list.get(position).getTvName());
        holder.tvTime.setText(list.get(position).getTvTime());
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public class BulletinViewHolder extends RecyclerView.ViewHolder {

        private TextView tvTitle;
        private TextView tvName;
        private TextView tvTime;

        public BulletinViewHolder(@NonNull View itemView) {
            super(itemView);
            tvTitle = itemView.findViewById(R.id.tvTitle);
            tvName = itemView.findViewById(R.id.tvName);
            tvTime = itemView.findViewById(R.id.tvTime);
        }
    }


}
